package cn.com.dhcc.app.pub.core.job;

import org.apache.log4j.Logger;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import cn.com.dhcc.app.core.exception.ServiceException;
import cn.com.dhcc.app.core.service.Log;
import cn.com.dhcc.app.core.service.Log.LOGTYPE;
import cn.com.dhcc.app.pub.CM;
import cn.com.dhcc.ddi.stat.service.DataSyncStatService;
import cn.com.dhcc.ddi.stat.service.TaskSyncStatService;

public class DailyStatisticsJob implements Job{

	private static Logger logger = Log.getLogger(LOGTYPE.DDI);
	
	public void performDailyStatistics() {
		 logger.info("每日统计任务开始");
		try {
			TaskSyncStatService taskSyncStatService = CM.getBean(TaskSyncStatService.class);
			DataSyncStatService dataSyncStatService = CM.getBean(DataSyncStatService.class);
			taskSyncStatService.dailyTaskStatistics();
			dataSyncStatService.dailyDataStatistics();
		} catch (ServiceException e) {
			logger.error("每日统计异常", e);
		}
		
		
	}
	@Override
	public void execute(JobExecutionContext context)
			throws JobExecutionException {
		performDailyStatistics();
	}

}
